UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0ExJ4GgxGL3g4vyUu0Q5+wMRKAyv6zhNtjERAlaWJIg=' 
WHERE 
  key_id = '963dcada5011708be44f505f47d9c7cb565714745963f13287740b6f42945464' 
  AND (
    token = '0ExJ4GgxGL3g4vyUu0Q5+wMRKAyv6zhNtjERAlaWJIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034