UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RySYHR1ZTY5mzOH3HtASfEmiyW1C3pavF1ruL2UvGkI=' 
WHERE 
  key_id = '887179bccdab8a421152a7a1928e50c1935e464dcebdd088d44ca60e6e3a6018' 
  AND (
    token = 'RySYHR1ZTY5mzOH3HtASfEmiyW1C3pavF1ruL2UvGkI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020