UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n2s+IQ4S7coGG/RLJZk+JVXlvOKXAhfFw9rXm9bi6Mk=' 
WHERE 
  key_id = 'c844a22edd24690b3ecbdea13a5e55aa1e9216ef4674057c57bc9fcb64054051' 
  AND (
    token = 'n2s+IQ4S7coGG/RLJZk+JVXlvOKXAhfFw9rXm9bi6Mk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024