UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q2Zm2CcMeHVMA06A80eyftOaVc5kPfqlShAsIQz4HAY=' 
WHERE 
  key_id = '9dda1d0ab91aa653881667abd655eb0c5296c28b8af02ab125979c5cba97f719' 
  AND (
    token = 'q2Zm2CcMeHVMA06A80eyftOaVc5kPfqlShAsIQz4HAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039