UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9Ytwpu/1faMN8r3uY7a+emA/Nr5SMfxZcXl4ASaX7eA=' 
WHERE 
  key_id = '47c97547764087ae9cff5b0e9d426dc7031fc55f32c4eac846af739a1ed1c6b9' 
  AND (
    token = '9Ytwpu/1faMN8r3uY7a+emA/Nr5SMfxZcXl4ASaX7eA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045