UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OnSYFk8qD8+zgC5TklSdVraGcrC39hD/MOnkqENA4Uc=' 
WHERE 
  key_id = '458fa4a470d585e131d67026e54f73fa4005484e98c4f81efc9b3b6b2d538f53' 
  AND (
    token = 'OnSYFk8qD8+zgC5TklSdVraGcrC39hD/MOnkqENA4Uc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049