UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PkQ1kaTUcOBhsomQTuQjzrcDzo2zFxEi0JDfXBoyR6s=' 
WHERE 
  key_id = '695d3fca8a4fbe6a52f32af79fa3c785ab176d2ec181336a6bc361d7e4aea1ba' 
  AND (
    token = 'PkQ1kaTUcOBhsomQTuQjzrcDzo2zFxEi0JDfXBoyR6s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023