UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yv3D/ZGlrJP7KLlH/wpNKzKRwkTPkgyVfI1eSlzc9a4=' 
WHERE 
  key_id = '31dfcabeaef476e2cbb060c6ea186cd188108ef27acf43003471fde00035014a' 
  AND (
    token = 'yv3D/ZGlrJP7KLlH/wpNKzKRwkTPkgyVfI1eSlzc9a4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041