UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KDF+hJ3/VdS0iLaimqPvp+RZjiY+Waqok3HR3Dq+26w=' 
WHERE 
  key_id = '12ec509127987fae57c4b0879c60fadcb85754d37bade40e210a33d558d8966b' 
  AND (
    token = 'KDF+hJ3/VdS0iLaimqPvp+RZjiY+Waqok3HR3Dq+26w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030