UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jGRr7US9BXWXrwy+nOdTK8tLpIQZ1pocjQdH6DKXmHY=' 
WHERE 
  key_id = '23c8c9aacb6c51941b3314be83b157c765fa59c4103e0264e5bcd7889a8414ab' 
  AND (
    token = 'jGRr7US9BXWXrwy+nOdTK8tLpIQZ1pocjQdH6DKXmHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037