UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C1uliNgPqcxCzJvtKdeIokDmMgRuEh4O64ybx8v7o/k=' 
WHERE 
  key_id = '744cec7ce2398b17957881794d1eab5ad7c57991d57166014455c56506accfa4' 
  AND (
    token = 'C1uliNgPqcxCzJvtKdeIokDmMgRuEh4O64ybx8v7o/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031