UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D9wJXYu3rDpUPcScyGI5tdVsnw1E9r+Xsy6umAEsmw4=' 
WHERE 
  key_id = 'e7d94c7ca53b3ca5edc1944a1ed10ddbdf2c099338e400b04526bd9a1df84324' 
  AND (
    token = 'D9wJXYu3rDpUPcScyGI5tdVsnw1E9r+Xsy6umAEsmw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040