UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MJUqfnvXd1OAXSIDdSvNINsyBAVb8DFMnSPr6dFrSXM=' 
WHERE 
  key_id = 'e9660319601190588ee31090b9600699e8f1ad32ec42ab91cb71a08209a523c4' 
  AND (
    token = 'MJUqfnvXd1OAXSIDdSvNINsyBAVb8DFMnSPr6dFrSXM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026