UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sz457tzKddXKvhtNtcqX+uq3l04V1QV1fspK+d9sFm0=' 
WHERE 
  key_id = '09f251a2ee983c66a84b1efc2c6e5dcbeb98d999f38fac528d8a5b4d8869eefd' 
  AND (
    token = 'Sz457tzKddXKvhtNtcqX+uq3l04V1QV1fspK+d9sFm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025