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

Query time 0.00043