UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZQJT3cfBl6W8r4bzSBXP+7kk5NQhYieH/wX+PawnWNQ=' 
WHERE 
  key_id = '279aa592ebd644821c9649f6add7d6346826c1b324b5593293a276f8d7cf351a' 
  AND (
    token = 'ZQJT3cfBl6W8r4bzSBXP+7kk5NQhYieH/wX+PawnWNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032