UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IKr0RdCoXBwcZn9+sJLRHOXgjXjjB7L7x7AcVWCiWbI=' 
WHERE 
  key_id = '2f9759b1faafe5eee88a95b68103c7744a29013f0bb133b578c4b5306ce4ff3a' 
  AND (
    token = 'IKr0RdCoXBwcZn9+sJLRHOXgjXjjB7L7x7AcVWCiWbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037