UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XwRt2Ca+Yy6JSUjOdmrwXqMR6AG0Bn960YObfC4Zp7o=' 
WHERE 
  key_id = '540ddc982dc35aba20a668a705ec12e6cb216fa7fe1aab60b6925a7673442ae7' 
  AND (
    token = 'XwRt2Ca+Yy6JSUjOdmrwXqMR6AG0Bn960YObfC4Zp7o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040