UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ldcau3IfBGBr2YeTWgph4JNxNAHcC4UTYrAOkRt1EAg=' 
WHERE 
  key_id = 'ec39a1816e60411c690143f0d9ef97b1e01de54a1f274787f66cb169692999c9' 
  AND (
    token = 'ldcau3IfBGBr2YeTWgph4JNxNAHcC4UTYrAOkRt1EAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042