UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tIvOlzaoEHmKpClaq2ug2LAQiwDAqiXh35MAUDL+Wqk=' 
WHERE 
  key_id = '443807419029f22369d5168d16a98b86edcebe9489c0d381b95159cdcbbd8524' 
  AND (
    token = 'tIvOlzaoEHmKpClaq2ug2LAQiwDAqiXh35MAUDL+Wqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032