UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uNIfh5f7DN94GFqLTe9uLaf7t/ZFzelRVqHCfoyJcy4=' 
WHERE 
  key_id = '304d4fb5dce9adf613f6e773329127771b0197728fcdd995ee62461bec7e5dc5' 
  AND (
    token = 'uNIfh5f7DN94GFqLTe9uLaf7t/ZFzelRVqHCfoyJcy4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021