UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'muCZ8DaSHeL4c/+RcGtukuRKmL9Lbo7J7ryiAOSG+J0=' 
WHERE 
  key_id = '5923dbce97d4dfb3eaa953a79c0c1696a89d904d36119b32c010eaa1abed1239' 
  AND (
    token = 'muCZ8DaSHeL4c/+RcGtukuRKmL9Lbo7J7ryiAOSG+J0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039