UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aPz2ZFl4EGgiB7n9JRERSGHPeHZOIDzMCY2uGEOr3+g=' 
WHERE 
  key_id = 'f401d416dbf25cdb6f37e9e28191b5e1129bec9a163d19009aef88b97a80b2f7' 
  AND (
    token = 'aPz2ZFl4EGgiB7n9JRERSGHPeHZOIDzMCY2uGEOr3+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031