UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x+m2RGEK6bw9Efj80ccLlLy/hDaL9E1W9dHGhnSNEYM=' 
WHERE 
  key_id = 'afc8b9eaceb605bdaec925a9e926d3ee430b2ae6d0ec23f106057de24d9fd3fe' 
  AND (
    token = 'x+m2RGEK6bw9Efj80ccLlLy/hDaL9E1W9dHGhnSNEYM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058