UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0qHP2+Yop1R9qVZ07oHajnjAdDO8HFsBMVdZUH1DWok=' 
WHERE 
  key_id = '5d936f5218dd93efbbb56288063d964e9656adf2a7e750196a53ee284cbee5b3' 
  AND (
    token = '0qHP2+Yop1R9qVZ07oHajnjAdDO8HFsBMVdZUH1DWok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029