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

Query time 0.00039