UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QHbVDi8D7/ru+ENbIotyKG89ybTsVc/eJzX1dLdYmIk=' 
WHERE 
  key_id = '1271c24e9001a1ba9eb66fb000bdf267378379987848c0d969a3d561279016d9' 
  AND (
    token = 'QHbVDi8D7/ru+ENbIotyKG89ybTsVc/eJzX1dLdYmIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032