UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9bM5fONoIIpG4nSKQhFZn61bxeVjf0z7rW5u4VO+H+8=' 
WHERE 
  key_id = 'ccc9236e4c56063a3742d5ef7b22492ebd1604fda9b731df3c010279ee24cde3' 
  AND (
    token = '9bM5fONoIIpG4nSKQhFZn61bxeVjf0z7rW5u4VO+H+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044