UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3mUv4rw2GWfbV2n0xmJbFqeCxBtIFSBALVYnGz+xyOM=' 
WHERE 
  key_id = '395cb512d5cd6c98ea51981ac1c3d38402599233191f5ec36a1fdb4661569214' 
  AND (
    token = '3mUv4rw2GWfbV2n0xmJbFqeCxBtIFSBALVYnGz+xyOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020