UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kpHkxqNGGk9LfursQPXNVdkEbJ/s2ZN62izQuuJ8W9s=' 
WHERE 
  key_id = 'a791205d606c0c3b1ca8b7c1bc70542f4e58de08a5a164b34690be597a8720ea' 
  AND (
    token = 'kpHkxqNGGk9LfursQPXNVdkEbJ/s2ZN62izQuuJ8W9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024