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

Query time 0.00050