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

Query time 0.00034