UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sRK1XbXXcxOipEi2I0R8HJW7VS166Pt8aw/LcJRDGvY=' 
WHERE 
  key_id = 'ba180b7a4d31989b7f183652c3dcd609aef51bcb88890cf4b88130d62c0f23a6' 
  AND (
    token = 'sRK1XbXXcxOipEi2I0R8HJW7VS166Pt8aw/LcJRDGvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032