UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'puuoQsyyFR+ZhxFCjpAngdSsUCmgnLpU3lxXsQdr7wc=' 
WHERE 
  key_id = 'a665b732adc08123a62372f1f3e026a872ac98d86c57b7d8fabbf8a90b5930b2' 
  AND (
    token = 'puuoQsyyFR+ZhxFCjpAngdSsUCmgnLpU3lxXsQdr7wc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048