UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MflGIqqLU1v62KFRZawDJwSHsNO8RxMXEQQ3gc7QgXU=' 
WHERE 
  key_id = 'd9c8ff00f8836d3257a3f752d42a82266a4a495b9a8edf1f08137ecb7be95f42' 
  AND (
    token = 'MflGIqqLU1v62KFRZawDJwSHsNO8RxMXEQQ3gc7QgXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00088