UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PQdYIpXx7D39Z6VWPwGZGIfNTE8Auz18pdVPzF6hrMI=' 
WHERE 
  key_id = '17b67943881a0b443447e030e8ea7125c0957d3952083b112000839767eb36d5' 
  AND (
    token = 'PQdYIpXx7D39Z6VWPwGZGIfNTE8Auz18pdVPzF6hrMI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035