UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NQPefqQoBkK6ykVhqSorDBSMuSpewVSaUeBVtR+qwcg=' 
WHERE 
  key_id = '87fbc9b30eba3a8409be39077a53b3624da7fdee11502c5c8bd52f41d6e13e54' 
  AND (
    token = 'NQPefqQoBkK6ykVhqSorDBSMuSpewVSaUeBVtR+qwcg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037